package org.biodas.jdas.client.threads;

import java.net.HttpURLConnection;
import java.util.Map;

import org.biodas.jdas.client.ConnectionPropertyProviderI;

public class StandardHeaderMultipleConnectionProvider implements MultipleConnectionPropertyProviderI,ConnectionPropertyProviderI {
	  private Map<String,String> standardHeaders;
	  public StandardHeaderMultipleConnectionProvider(Map<String,String> headers) {
	    standardHeaders=headers;
	  }
	  public ConnectionPropertyProviderI getConnectionPropertyProviderFor(String sourceUrl) {
		  return this;
	  }
	  public void setConnectionProperties(
			  HttpURLConnection paramHttpURLConnection) {
	    for (Map.Entry<String,String> header:standardHeaders.entrySet()) {
	    	paramHttpURLConnection.addRequestProperty(header.getKey(),header.getValue());
	    }
	  }
	  @Override
	public boolean getResponseProperties(
			HttpURLConnection paramHttpURLConnection) {
		  
		return false; // so jDas doesn't try and make the response again.
	}
}